﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YouHP.Model
{
    public class TreatmentHistoryInfo : IHydratable
    {

        public int Id { get; set; }
        public int PRId { get; set; }
        public int TreatmentId { get; set; }
        public int TreatmentTypeId { get; set; }
        public string TreamentTypeName { get; set; }
        public string TreatmentName { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public DateTime ChangeDate { get; set; }    //改变剂量日期
        public double ChangeDataValue { get; set; } //改变后的剂量值
        public DateTime UpdateDate { get; set; }
        public int State { get; set; }              // 0 表示正在使用 1 表示停用
        public DateTime ActionDate { get; set; }
        public int UsePurpose { get; set; }         // 使用目的是通过选择的
        public int StopReason { get; set; }
        public double DataValue { get; set; }
        public string Unit { get; set; }
        public string Frequency {get; set;}         // 该记录最后一次修改的剂量
        public int Privacy { get; set; }
        public string LimitValues { get; set; }

        public int TreatmentHistoryId { get; set; }
        public int IsUsing { get; set; }            //是否正在使用

        public int UsedTotalDay { get; set; }
      
        //其中 Actions

        public TreatmentHistoryInfo()
        {
            Id = PRId = TreatmentId = TreatmentHistoryId = TreatmentTypeId = - 1;
            UsePurpose = StopReason = Privacy = 0;

            StartDate = DateTime.Now;
            EndDate = DateTime.Now;

            Frequency = TreamentTypeName = TreatmentName = "";
        }
        
        #region IHydratable 成员

        public bool Fill(System.Data.IDataReader dr)
        {
            return false;
        }

        #endregion
    }

    public class TreatmentHistoryInfoComparer : IComparer<TreatmentHistoryInfo>
    {
        public int Compare(TreatmentHistoryInfo X, TreatmentHistoryInfo Y)
        {
            int iRet = X.IsUsing - Y.IsUsing;
            if (0 != iRet)
            {
                return iRet;
            }
            iRet = X.TreatmentId - Y.TreatmentId;
            if (0 != iRet)
            {
                return iRet;
            }

            iRet = X.StartDate.CompareTo(Y.StartDate);
            return iRet;
        }

    }
}
